package cn.zktr.Personnel.controllers.zhouxiong;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.zktr.Personnel.model.pojos.PerCwaRsn;
import cn.zktr.Personnel.model.service.zhouxiong.JiChuService;

@Controller
public class YuanYinController {

	@Autowired
	private JiChuService jichu;
	
	@RequestMapping("zx/yuan-yin")
	public void zhujiemian() {}
	
	@RequestMapping("YuanYinF")
	@ResponseBody
	public Map<String,Object> yuanyinFenYe(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",jichu.seleYuanYin().size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=jichu.seleYuanYin();
		//页内容
		map.put("rows",findAll);
		return map;
	}
	
	@PostMapping("updateYY")
	@ResponseBody
	public String updateYY(Integer rsnid,String rsnreason,String rsnrem,Model model) {
		jichu.updateYY( rsnid, rsnreason, rsnrem);
//		kaoqin( model);
		return "";
	}
	
	@PostMapping("deleteYY")
	@ResponseBody
	public String deleteYY(String RSNID,Model model) {
		jichu.deleteYY(Integer.valueOf(RSNID));
//		kaoqin( model);
		return "";
	}
	
//	public void kaoqin(Model model) {
//		model.addAttribute("YuanYin", jichu.seleYuanYin());                   //原因
//	}
}
